from rest_framework import serializers
from .models import ProvincePatent, Keyword, WordPair, TopOrg

class ProvincePatentSerializer(serializers.ModelSerializer):
    """省份专利数据序列化器"""
    class Meta:
        model = ProvincePatent
        fields = ['province', 'count']

class KeywordSerializer(serializers.ModelSerializer):
    """核心词序列化器"""
    class Meta:
        model = Keyword
        fields = ['keyword', 'count']

class WordPairSerializer(serializers.ModelSerializer):
    """词对关系序列化器"""
    class Meta:
        model = WordPair
        fields = ['kword1', 'kword2', 'co_count']

class TopOrgSerializer(serializers.ModelSerializer):
    """机构专利排名序列化器"""
    class Meta:
        model = TopOrg
        fields = ['org', 'count'] 